<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/new.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath }/css/bootstrap.min.css">
    <script src="${pageContext.request.contextPath }/js/jquery.min.js"></script>
    <title>Login</title>
</head>

<body class="gray-body">

	<div class="container">
	    <div class="login-container panel ">
	        <!--<div class="panel-body" style="background: rgba(0,0,0,0.13);">-->
	        <div class="panel-body trans-bg">
	            <h1 class="login-title">Login</h1>
	                <div class="form-group">
	                    <label for="tel">Telephone</label>
	                    <div class="input-group">
	                        <span class="input-group-addon"><span class="glyphicon glyphicon-phone"></span> </span>
	                        <input type="text" class="form-control" id="tel" name="tel" placeholder="Telephone..." value="13926957686" autofocus>
	                    </div>
	                    <span class="red-span" id="tel-alert"></span>
	                    <span style="color:green;" id="tel-success"></span>
	                </div>
	                <div class="form-group">
	                    <label for="pwd">Password</label>
	                    <div class="input-group">
	                        <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span> </span>
	                        <input type="password" class="form-control" id="pwd" name="pwd" value="123456" placeholder="Password...">
	                        <span class="red-span" id="pwd-alert"></span>
	                    </div>
	                </div>
	                <span id="login-alert" class="red-span" style="margin-left:20px;"></span><br>
	                <div class="form-group">
	                    <button type="submit" class="btn btn-common login-btn" id="login-btn">Login</button>
	                    <a href="${pageContext.request.contextPath }/linkRegister" class="btn gray-btn">Register</a>
	                </div>
	        </div>
	    </div>
	</div>

</body>


<script type="text/javascript">

	 $(function(){
		
		$("#login-btn").on("click",function(){
          $.ajax({
              url:"${pageContext.request.contextPath}/signIn",
              type:"post",
              data:{tel:$("#tel").val(),pwd:$("#pwd").val()},
              success:function(d){
            	  if(!d.status){
            		  $("#login-alert").html("对不起，用户名或密码有误！！请重新输入！");
            	  }else{
            		  window.location.href = "${pageContext.request.contextPath}/home";
            	  }
              }
          })
      	});
		
	}); 
	
</script>


</html>